<form class="form-inline" method="get">
    <div class="form-group col-xs-4">
        {include file="public/areaSelector" province-name="pro" city-name="city" /}
    </div>

    <div class="form-group col-xs-2">
        <select id="category-selector" name="cid" class="form-control" tabindex="-1">
            <option value="">
                无选择
            </option>
            <?php $category_list = get_swiper_category('',2); ?>
            {volist name="category_list" id="item" key="itk"}
            <option value="{$itk}" {if condition="$cid==$itk"}selected{/if}>{$item}</option>
            {/volist}
        </select>
    </div>

    <div class="form-group col-xs-4">
        <button type="submit" class="btn btn-success">
            搜索
        </button>

        <button type="button" class="btn btn-primary" onclick="modal('{:url(\'addSwiper\')}','添加幻灯片')">
            添加幻灯片
        </button>
    </div>
</form>

<hr>

<table class="table table-striped">
    <thead>
    <tr>
        <td>ID</td>
        <td>地区</td>
        <td>轮播类型</td>
        <td>图片</td>
        <td>排序</td>
        <td>是否显示</td>
        <td>编辑时间</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="item"}
    <tr>
        <td>{$item.id}</td>
        <td>{:get_regionName($item['pro'])}-{:get_regionName($item['city'])}</td>
        <td>{$item.category_id|get_swiper_category}</td>
        <td>
            <a href="javascript:void(0);" onclick="ejectImg('{$item.thumb}','轮播【ID：{$item.id}】图片');">
                <img style="width:100px;height:50px;" src="{$item.thumb}">
            </a>
        </td>
        <td>{$item.display_order}</td>
        <td>
            {if condition="$item.is_visible ==1"}
            显示
            {else /}
            隐藏
            {/if}
        </td>

        <td>{$item.update_time|show_datetime}</td>
        <td>

            <a href="javascript:void(0)" class="btn btn-primary btn-sm"
               onclick="modal('{:url(\'editSwiper\',array(\'aid\'=>$item[\'id\']))}')">编辑</a>
            <a href="javascript:void(0)" class="btn btn-danger btn-sm" data-toggle="confirm" data-title="删除"
               data-content="确定要删除吗？"
               data-url="{:url('removeSwiper',array('rid'=>$item['id']))}">删除</a>

        </td>
    </tr>
    {/volist}
    </tbody>
</table>

<div class="row">
    <div class="col-xs-12" style="text-align: right;">
        {$list->render()}
    </div>
</div>

<div class="row">
    <div class="col-xs-12" style="text-align: right;">
        {$list->render()}
    </div>
</div>
<script src="__PUBLIC__/vendors/select2/js/select2.min.js"></script>
<script type="application/javascript">
    $(function () {

        //获取分类
        $("#category-selector").select2({
            placeholder: "选择轮播类型",
            allowClear: true
        });
    });
</script>